package si.yun.web.handler;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @ClassName ExceptionHandling
 * @Author SXM
 * @Date 2021/07/28 21:08
 * @Version 1.0
 * 统一异常处理页面
 */
//@ControllerAdvice
public class ExceptionHandling {
 /*   @ExceptionHandler(value = Exception.class)
    public ModelAndView handlerExcption(){//HttpServletRequest req,Exception e
        System.out.println("走异常了");
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("erroy.html");
        modelAndView.addObject("msg","服务器错误");//e.getMessage()
        return modelAndView;
    }
*/

   /* public static final String IMOOC_ERROR_VIEW = "error";
    @ExceptionHandler(value = Exception.class)
    public Object errorHandler(HttpServletRequest reqest,
                               HttpServletResponse response, Exception e) throws Exception {
        e.printStackTrace();

        ModelAndView mav = new ModelAndView();
        mav.addObject("exception", e);
        mav.addObject("url", reqest.getRequestURL());
        mav.setViewName("erroy.html");
        return mav;
    }
*/

}
